﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- saved from url=(0014)about:internet -->
<html>
	<head>
		<title>突发事件</title>
        <script src="jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
        <link href="Stylesheet1.css" rel="Stylesheet" type="text/css" />
		<style type="text/css">
</style>
	</head>
<body scroll="no" bgcolor="#FFFFFF" >
<div style="width:707px;height:401px;border:1px solid gray;margin-left:-10px;margin-top:-16px;" id="container"></div>
<div style="display:inline;">
<span>
	<input name="emergency" style="width: 68px; height: 25px; font-size: 12px; font-family: 微软雅黑; display:none;" type="button"  id="emergency" onclick="Select2();" class="auto-style1" value="突发事件"></span>
</div>


</body>
</html>
<script type="text/javascript">
    var map = new BMap.Map("container");            // 创建Map实例
    var point = new BMap.Point(121.22, 31.48);    // 创建点坐标
    map.centerAndZoom(point, 15);                     // 初始化地图,设置中心点坐标和地图级别。
    map.addControl(new BMap.NavigationControl());
    map.addControl(new BMap.ScaleControl());
</script>
<script type="text/javascript">
    $(document).ready(function () {
        var emergency = document.getElementById('emergency').value;
        window.external.ClickEvent(emergency);
        Addpoint();
    });
    function Select1() {
        var fire = document.getElementById('fire').value;
        window.external.ClickEvent(fire);
        //alert(window.external.name);
        Addpoint();
    }
    function Select2() {
        var emergency = document.getElementById('emergency').value;
        window.external.ClickEvent(emergency);
        //alert(window.external.name);
        Addpoint();
    }
    function Addpoint() {
        var jsonconf = $.parseJSON(window.external.name);
        var points = [];
        map.clearOverlays();
        for (var i = 0; i < jsonconf.length; i++) {
            addMarker1(new BMap.Point(jsonconf[i].Longitude, jsonconf[i].Latitude), jsonconf[i].Name, jsonconf[i].Description, jsonconf[i].Tel);
            points.push(new BMap.Point(jsonconf[i].Longitude, jsonconf[i].Latitude));
        }
        map.setViewport(points);
    }
    function addMarker1(point1, text, description, tel) {
        var marker = new BMap.Marker(point1);
        map.addOverlay(marker);
        var label = new BMap.Label(text, { offset: new BMap.Size(20, -10) });
        marker.setLabel(label);

        var sContent =
            "<div><h4 style='margin:0 0 5px 0;padding:0.2em 0'>" + text + "</h4>" +
            "<p style='margin:0;line-height:1.5;font-size:13px;text-indent:2em;width:180px;'>" + description + "</p>" + "电话：" + tel +
            "</div>";

        var infoWindow = new BMap.InfoWindow(sContent);  // 创建信息窗口对象
        marker.addEventListener("click", function () {
            this.openInfoWindow(infoWindow);
            //图片加载完毕重绘infowindow
        });
    }
</script>